//
// Created by tang on 2022/1/10.
//

#ifndef DIARYTOOL_FORM_HPP
#define DIARYTOOL_FORM_HPP

#include <string>

struct GLFWwindow;

#if defined(CreateWindow) // f**k vc macros
#undef CreateWindow
#endif

class MainFromBase {
    std::string const m_title_;
    int const m_init_width_;
    int const m_init_height_;

    friend class Application;
public:
    MainFromBase(std::string title, int width, int height);
    virtual ~MainFromBase();

    virtual void ShowDialog(const std::string& dlg_name);
    virtual void ShowDialog(unsigned int dlg_id);
protected:

    // using ImGui and ImPlot Api inside this function, if override you should call MainFromBase::OnDraw first.
    virtual void OnDraw();

    // config fonts
    virtual void SetupFonts(float fontSize);

    // config Styles
    virtual void SetupStyles();

    // init components
    virtual void Init();
    virtual void Cleanup();

public:
    GLFWwindow* CreateWindow(const char** glsl_version, bool maximized);
    void DestroyWindow(GLFWwindow* win);
    // tet window topmost
    static void ToggleWindowTopmost(bool enable);
};

#endif //DIARYTOOL_FORM_HPP
